import Vue from 'vue'
import Vuex from 'vuex'
import Cookies from 'js-cookie'
import audio from './aduio'
Vue.use(Vuex)
const state = {
  homeaudiodata: '',
  active: 1,
  app_id: 'Zmli',
  member_id: Cookies.get('member_id'),
  // Z20%3D
  // Cookies.get('member_id')
  // aQ%3D%3D
  // member_id: 'Zmli',
  openid: Cookies.get('openid'),
  qiniu: 'http://o6wndwjxn.qnssl.com/',
  url: 'http://web.zhiyunzaixian.com',
  category: '',
  curriculum_id: '',
  chapter_id: '',
  introduction_video: '',
  cover: '',
  content: '',
  title: '',
  _go: '',
  isLoading: false,
  bts: false, // 点击评论按钮专用状态,
  HomeScrollY: ''
}
const getters = {}
const mutations = {
  sethomeaudiodata (state, n) {
    state.homeaudiodata = n
  },
  audioState (state, n) {
    state.audioState = n
  },
  HomeScrollY (state, n) {
    state.HomeScrollY = n
    // console.log(n, '提交成功')
  },
  evaluate (state, bts) {
    state.bts = bts
  },
  updateLoadingStatus (state, payload) {
    // console.log(payload.isLoading)
    state.isLoading = payload.isLoading
  },
  active (state, n) {
    state.active = n
  },
  app_id (state, n) {
    state.appid = n
  },
  category (state, n) {
    state.category = n
  },
  openid (state, n) {
    state.openid = n
    Cookies.set('openid', n)
  },
  member_id (state, n) {
    state.member_id = n
    Cookies.set('member_id', n)
  },
  curriculum_id (state, n) {
    state.curriculum_id = n
  },
  chapter_id (state, n) {
    state.chapter_id = n
  },
  introduction_video (state, n) {
    state.introduction_video = n
  },
  cover (state, n) {
    state.cover = n
  },
  content (state, n) {
    state.content = n
  },
  title (state, n) {
    state.title = n
  },
  _url (state, n) {
    state._url = n
  },
  _go (state, n) {
    state._go = n
  },
  urls (state, n) {
    state.urls = n
  }
}
export default new Vuex.Store({
  state,
  getters,
  mutations,
  // 通过modules属性引入login 模块。
  modules: {
    audio: audio
  }
})
